package com.edu.admin;

import java.util.Collections;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;


/**
 * 
 *  
 * @author Wangjiong
 * 
 */
public class ServletInitializer extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(EduAdminApplication.class);
	}
	
	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
			super.onStartup(servletContext);
			servletContext.setSessionTrackingModes(
					Collections.singleton(SessionTrackingMode.COOKIE));

			SessionCookieConfig sessionCookieConfig =
					servletContext.getSessionCookieConfig();
					sessionCookieConfig.setHttpOnly(true);
	}

}
